home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
mig
/
RCS
/
Mig_GetPdevName.c,v
< prev
next >
Wrap
Text File
|
1990-06-22
|
3KB
|
153 lines
head 2.0;
branch ;
access ;
symbols no-auto-remigrate:2.0 installed:2.0;
locks ; strict;
comment @ * @;
2.0
date 90.03.10.13.13.02; author douglis; state Stable;
branches ;
next 1.2;
1.2
date 90.03.10.13.11.25; author douglis; state Exp;
branches ;
next 1.1;
1.1
date 90.02.16.15.15.05; author douglis; state Exp;
branches ;
next ;
desc
@routine to get the name of the global or host-specific pdev.
@
2.0
log
@Changing version numbers.
@
text
@/*
* Mig_GetPdevName.c --
*
* This file contains the Mig_GetPdevName procedure, which
* returns the string corresponding to the pseudo-device
* used for either the global server or the local host.
*
* Copyright 1990 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#ifndef lint
static char rcsid[] = "$Header: /sprite/src/lib/c/mig/RCS/Mig_GetPdevName.c,v 1.2 90/03/10 13:11:25 douglis Exp Locker: douglis $ SPRITE (Berkeley)";
#endif not lint
#include <fs.h>
#include <stdio.h>
#include <mig.h>
extern char *strcpy();
/*
* Define the pseudo-devices used to communicate with the local
* and global migration daemons. LOCAL_PDEV is used to form
* a string based on the hostname.
*/
#ifndef GLOBAL_PDEV
#define GLOBAL_PDEV "/sprite/admin/migd/pdev"
#endif
#ifndef LOCAL_PDEV
#define LOCAL_PDEV "/hosts/%s/migd.pdev"
#endif
static char *globalPdev = GLOBAL_PDEV;
static char *localPdev = NULL;
/*
*----------------------------------------------------------------------
*
* Mig_GetPdevName --
*
* Return the name of the specified pseudo-device. If global
* is non-zero, then return the name of the global pdev, else
* the one for this host.
*
* Results:
* A pointer to the name is returned. If an error is returned
* when getting the host name, NULL is returned.
*
* Side effects:
* Memory is allocated to hold the file name.
*
*----------------------------------------------------------------------
*/
char *
Mig_GetPdevName(global)
int global; /* Whether to return the global pdev name. */
{
char hostName[FS_MAX_NAME_LENGTH];
char fileName[FS_MAX_NAME_LENGTH];
int status;
extern char *malloc();
if (global) {
return(globalPdev);
}
if (!localPdev) {
status = gethostname(hostName, FS_MAX_NAME_LENGTH);
if (status != 0) {
return((char *) NULL);
}
(void) sprintf(fileName, LOCAL_PDEV, hostName);
localPdev = malloc((unsigned) (strlen(fileName) + 1));
if (localPdev == (char *) NULL) {
return(localPdev);
}
(void) strcpy(localPdev, fileName);
}
return(localPdev);
}
@
1.2
log
@changed name of pdevs
@
text
@d19 1
a19 1
static char rcsid[] = "$Header: /sprite/src/lib/c/mig/RCS/Mig_GetPdevName.c,v 1.1 90/02/16 15:15:05 douglis Exp Locker: douglis $ SPRITE (Berkeley)";
@
1.1
log
@Initial revision
@
text
@d19 1
a19 1
static char rcsid[] = "$Header: /sprite/src/lib/c/mig/RCS/Mig_GetPdevName.c,v 1.1 90/02/16 14:29:34 douglis Exp $ SPRITE (Berkeley)";
d34 1
a34 1
#define GLOBAL_PDEV "/sprite/admin/migInfo.pdev"
d38 1
a38 1
#define LOCAL_PDEV "/hosts/%s/migInfo.pdev"
@